package cn.mandy.sysadmin.dto;

import cn.mandy.sysadmin.common.util.MandyTree;
import cn.mandy.sysadmin.model.MandyPermission;
import cn.mandy.sysadmin.model.MandyRolePermParam;
import cn.mandy.sysadmin.model.MandyRolePermission;
import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

public class MandyRoleResource implements MandyTree<MandyRoleResource> {

    private List<MandyRoleResource> children;

    @JSONField(serialize=false)
    private MandyPermission mandyPermission;

    @JSONField(serialize=false)
    private MandyRolePermission mandyRolePermission;

    @Override
    public List<MandyRoleResource> getChildren() {
        return children;
    }

    @Override
    public void setChildren(List<MandyRoleResource> children) {
        this.children = children;
    }

    @Override
    public Long getParentId() {
        return mandyRolePermission.getParentId();
    }

    @Override
    public void setParentId(Long parentId) {
        mandyRolePermission.setParentId(parentId);
    }

    @Override
    public Long getId() {
        return mandyRolePermission.getId();
    }

    @Override
    public void setId(Long id) {
        mandyRolePermission.setId(id);
    }

    public MandyRoleResource(){
        mandyPermission = new MandyPermission();
        mandyRolePermission = new MandyRolePermission();
        children = new ArrayList<>();
    }

    public MandyPermission getMandyPermission() {
        return mandyPermission;
    }

    public void setMandyPermission(MandyPermission mandyPermission) {
        this.mandyPermission = mandyPermission;
    }

    public MandyRolePermission getMandyRolePermission() {
        return mandyRolePermission;
    }

    public void setMandyRolePermission(MandyRolePermission mandyRolePermission) {
        this.mandyRolePermission = mandyRolePermission;
    }

    //a.id, a.parent_id, a.role_id, a.permission_id, a.auditstate, a.iz_allowed,
    public Long getRoleId(){return mandyRolePermission.getRoleId();}

    public void setRoleId(Long roleId){
        mandyRolePermission.setRoleId(roleId);}

    public Long getPermissionId() {
        return mandyRolePermission.getPermissionId();
    }

    public void setPermissionId(Long permissionId) {
        mandyRolePermission.setPermissionId(permissionId);
    }

    public String getAuditState() {
        return mandyRolePermission.getAuditState();
    }

    public void setAuditState(String state) {
        mandyRolePermission.setAuditState(state);
    }

    public String getIzAllowed() {
        return mandyRolePermission.getIzAllowed();
    }

    public void setIzAllowed(String izAllowed) {
        mandyRolePermission.setIzAllowed(izAllowed);
    }

    //b.perm_type, b.title, b.name, b.icon_class, b.remark, b.auditstate as p_state
    public String getPermType() {
        return mandyPermission.getPermType();
    }

    public void setPermType(String permType) {
        mandyPermission.setPermType(permType);
    }

    public String getTitle() {
        return mandyPermission.getTitle();
    }

    public void setTitle(String title) {
        mandyPermission.setTitle(title);
    }

    public String getName() {
        return mandyPermission.getName();
    }

    public void setName(String name) {
        mandyPermission.setName(name);
    }

    public String getIconClass() {
        return mandyPermission.getIconClass();
    }

    public void setIconClass(String iconClass) {
        mandyPermission.setIconClass(iconClass);
    }

    public String getRemark() {
        return mandyPermission.getRemark();
    }

    public void setRemark(String remark) {
        mandyPermission.setRemark(remark);
    }

    public String getPermissionState() {
        return mandyPermission.getAuditState();
    }

    public void setPermissionstate(String state) {
        mandyPermission.setAuditState(state);
    }


    public List<MandyRolePermParam> getParameters() {
        return mandyPermission.getParameters();
    }

    public void setParameters(List<MandyRolePermParam> parameters) {
        mandyPermission.setParameters(parameters);
    }

    @Override
    public String toString() {
        return "MandyRoleResource{" +
                "children=" + children +
                ", mandyPermission=" + mandyPermission +
                ", mandyRolePermission=" + mandyRolePermission +
                '}';
    }
}
